﻿using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Globalization;
using System.Linq;
using System.Windows;
using System.Windows.Markup;
using Bonit_It.ViewModel;

namespace Bon.it
{
    /// <summary>
    /// Interaktionslogik für "App.xaml"
    /// </summary>
    public partial class App : Application
    {

        static App()
        {
            FrameworkElement.LanguageProperty.OverrideMetadata(
                   typeof(FrameworkElement),
                   new FrameworkPropertyMetadata(
                       XmlLanguage.GetLanguage(CultureInfo.CurrentCulture.IetfLanguageTag)));    
        }
        
      

        protected void ShowMainWindow()
        {
            MainWindow window = new MainWindow();
            MainViewModel model = new MainViewModel();
            EventHandler handler = null;
            handler = delegate
            {
                model.RequestClose -= handler;
                window.Close();
            };
            model.RequestClose += handler;


            window.DataContext = model;
            window.Show();
        }
        
        protected override void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);

            this.ShowMainWindow();
        }
    }
}
